/* 数字人页面主样式 - 使用CSS变量支持主题切换 */
.digital-human-page {
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary); /* 使用CSS变量，支持主题切换 */
  position: relative;
  overflow: hidden;
  font-family: 'Arial', 'Microsoft YaHei', sans-serif;
}

/* 顶部导航栏 - 使用CSS变量支持主题切换 */
.header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-color: transparent;
  background-image: url('../assets/image/bw.png');
  background-repeat: no-repeat;
  background-size: cover; /* 占满顶部 */
  background-position: center;
  border-radius: 0;
  z-index: 100;
  box-shadow: var(--header-shadow); /* 使用CSS变量，支持主题切换 */
}

.header-content {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 0 40px;
  position: relative;
}

.logo-image {
  height: 36px;
  width: auto;
  object-fit: contain;
  margin: 0;
}

.logo h1 {
  color: var(--text-primary); /* 使用CSS变量，支持主题切换 */
  font-size: 24px;
  font-weight: bold;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  text-align: center; /* 中文标题居中对齐 */
}

.logo p {
  color: var(--text-secondary); /* 使用CSS变量，支持主题切换 */
  font-size: 14px;
  margin: 2px 0 0 0;
  letter-spacing: 1px;
  text-align: center; /* 英文副标题居中对齐 */
}

.nav-menu {
  display: flex;
  gap: 20px;
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
}

.nav-btn {
  background: var(--btn-bg); /* 使用CSS变量，支持主题切换 */
  border: 1px solid var(--btn-border); /* 使用CSS变量，支持主题切换 */
  color: var(--text-primary); /* 使用CSS变量，支持主题切换 */
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.nav-btn:hover {
  background: var(--btn-hover-bg); /* 使用CSS变量，支持主题切换 */
  transform: translateY(-2px);
  box-shadow: var(--btn-shadow); /* 使用CSS变量，支持主题切换 */
}

/* 主内容区域 */
.main-content {
  position: relative;
  width: 100%;
  height: 100vh;
  padding-top: 80px;
  display: flex;
  flex-direction: column; /* 纵向排列：视频在上，评论在下 */
  justify-content: flex-start;
  align-items: center;
}

/* 背景网格纹理 - 使用CSS变量支持主题切换 */
.grid-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: gridMove 20s linear infinite;
  pointer-events: none; /* 不拦截交互 */
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(30px, 30px); }
}

/* 中央展示框 */
.content-frame {
  position: relative;
  width: 50%;
  max-width: 720px;
  height: 50%;
  z-index: 10;
  margin: 120px auto 0 auto; /* 再下移 */
}

.frame-border {
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-radius: 20px;
  background: var(--border-primary) border-box; /* 使用CSS变量，支持主题切换 */
  background-clip: padding-box;
  position: relative;
  box-shadow: var(--border-glow); /* 使用CSS变量，支持主题切换 */
  animation: borderGlow 3s ease-in-out infinite alternate;
}

@keyframes borderGlow {
  0% { box-shadow: var(--border-glow); }
  100% { box-shadow: var(--border-glow-hover); }
}

.video-container {
  width: 100%;
  height: 100%;
  border-radius: 17px;
  overflow: hidden;
  background: var(--bg-secondary); /* 使用CSS变量，支持主题切换 */
  position: relative;
}


.video-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary); /* 使用CSS变量，支持主题切换 */
  font-size: 24px;
  background: var(--bg-tertiary); /* 使用CSS变量，支持主题切换 */
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
  position: relative; /* 为弹幕层提供定位上下文 */
}

/* 评论输入区域（位于视频框下边内侧） */
.comment-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  width: 100%; /* 与视频同宽 */
  box-sizing: border-box;
  flex-wrap: nowrap; /* 不换行，保持一行 */
}

.comment-input {
  flex: 0 0 200px; /* 固定宽度，不自动扩展 */
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  min-width: 150px; /* 最小宽度 */
}

.comment-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.comment-send {
  height: 36px;
  padding: 0 12px; /* 减小内边距 */
  border-radius: 10px;
  border: none;
  background: var(--btn-primary-bg);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  min-width: 60px; /* 减小最小宽度 */
  flex-shrink: 0; /* 不收缩 */
}

.comment-send:hover {
  background: var(--btn-primary-bg-hover);
}

/* 弹幕控制区域 */
.danmaku-controls {
  display: flex;
  flex-direction: row; /* 改为水平排列 */
  align-items: center;
  gap: 8px; /* 水平间距 */
  flex-shrink: 0; /* 不收缩 */
}

/* 弹幕开关容器 */
.danmaku-toggle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px; /* 减小间距 */
}

/* 弹幕开关按钮 */
.danmaku-toggle-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #555;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.danmaku-toggle-btn.enabled {
  background: #ffffff;
  border-color: #ffffff;
}

.danmaku-toggle-btn.disabled {
  background: #666;
  border-color: #666;
}

.danmaku-toggle-btn:hover {
  transform: scale(1.05);
}

.toggle-icon {
  font-size: 12px;
  font-weight: bold;
  color: #000;
}

.danmaku-toggle-btn.disabled .toggle-icon {
  color: #999;
}

.toggle-text {
  font-size: 10px;
  color: #ffffff;
  white-space: nowrap;
  line-height: 1;
  margin-top: 2px;
}

/* 设置容器 */
.settings-container {
  position: relative;
  display: inline-block;
}

/* 设置图标按钮 */
.settings-icon-btn {
  height: 28px;
  width: 28px;
  padding: 0;
  border: 1px solid #555;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #999;
}

.settings-icon-btn:hover {
  border-color: #777;
  background: #333;
  color: #fff;
  transform: scale(1.05);
}

/* 弹幕样式选择器 */
.danmaku-style-selector {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.style-btn {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--bg-secondary);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-width: 40px;
  text-align: center;
}

.style-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.style-btn.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

/* 弹幕设置面板 - 下拉式 */
.danmaku-settings-panel {
  position: absolute;
  bottom: 100%; /* 在图标上方 */
  right: 0;
  margin-bottom: 8px; /* 与图标保持间距 */
  width: 280px; /* 进一步减小宽度 */
  background: #2a2a2a;
  border-radius: 8px; /* 减小圆角 */
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  padding: 0;
  border: 1px solid #444;
  animation: slideDown 0.3s ease-out;
  transform-origin: bottom;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 10px 16px; /* 减小内边距 */
  border-bottom: 1px solid #444;
}

.settings-title {
  font-size: 16px; /* 减小字体大小 */
  font-weight: bold;
  color: #ffffff;
  margin: 0;
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 4px; /* 减小间距 */
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 12px; /* 减小字体大小 */
  padding: 3px 6px; /* 减小内边距 */
  border-radius: 3px;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  color: #ffffff;
  background: #444;
}

.reset-icon {
  font-size: 16px;
}

.settings-content {
  padding: 12px 16px 16px 16px; /* 减小内边距 */
}

.setting-item {
  margin-bottom: 14px; /* 减小间距 */
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-label {
  display: block;
  color: #ffffff;
  font-size: 13px; /* 减小字体大小 */
  margin-bottom: 6px; /* 减小间距 */
  font-weight: 500;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 8px; /* 减小间距 */
}

.slider {
  flex: 1;
  height: 3px; /* 减小滑块高度 */
  background: #444;
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; /* 减小滑块按钮大小 */
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb {
  width: 14px; /* 减小滑块按钮大小 */
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 为滑块添加红色填充效果 */
.slider {
  background: linear-gradient(to right, #ff4444 0%, #ff4444 var(--slider-progress, 0%), #444 var(--slider-progress, 0%), #444 100%);
}

.slider-value {
  color: #ffffff;
  font-size: 12px; /* 减小字体大小 */
  min-width: 50px; /* 减小最小宽度 */
  text-align: right;
}

.color-picker-container {
  display: flex;
  align-items: center;
  gap: 8px; /* 减小间距 */
}

.color-picker {
  width: 32px; /* 减小颜色选择器大小 */
  height: 24px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.color-value {
  color: #ffffff;
  font-size: 12px; /* 减小字体大小 */
  font-family: monospace;
  min-width: 60px; /* 减小最小宽度 */
}

/* 弹幕输入框外部容器 */
.danmaku-input-outside {
  width: 50%;
  max-width: 720px;
  margin: 12px auto 0 auto; /* 与视频区域同宽并居中 */
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 30; /* 确保在装饰元素之上，可点击 */
}

/* 弹幕输入框容器 */
.danmaku-input-container {
  width: 100%;
  height: 48px;
  background: #2a2a2a;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid #444;
  position: relative;
  transition: all 0.3s ease;
}

.danmaku-input-container:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* 左侧控制区域 */
.danmaku-controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* 分隔线 */
.separator {
  width: 1px;
  height: 24px;
  background: #555;
  margin: 0 4px;
}

/* 中间输入框区域 */
.danmaku-input-wrapper {
  flex: 1;
  margin: 0 12px;
}

.danmaku-input {
  width: 100%;
  height: 32px;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 14px;
  padding: 0;
}

.danmaku-input::placeholder {
  color: #999;
}

/* 右侧按钮区域 */
.danmaku-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 表情按钮 */
.emoji-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #555;
  border-radius: 50%;
  background: transparent;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.emoji-btn:hover {
  border-color: #777;
  color: #fff;
  background: #333;
}

/* 发送按钮 */
.send-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #ff4444;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.send-btn:hover {
  background: #ff3333;
  transform: scale(1.05);
}

/* 评论框容器，用于设置面板定位 */
.comment-box {
  position: relative;
}

/* 简易弹幕层与条目 */
.danmaku-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 40%; /* 进一步限制弹幕只在视频上半部分显示，避免重叠 */
  pointer-events: none;
  overflow: hidden;
  z-index: 2; /* 覆盖在 video 之上 */
}

.danmaku-item {
  position: absolute;
  right: 0;
  white-space: nowrap;
  color: #fff;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  animation: danmakuMove 6s linear forwards;
  line-height: 1.2; /* 稍微增加行高，确保文字清晰 */
  padding: 2px 0; /* 添加少量垂直内边距，避免文字贴边 */
  margin: 0; /* 移除所有外边距 */
  min-height: auto; /* 移除最小高度限制 */
  display: block; /* 改为block，避免flex的影响 */
  box-sizing: content-box; /* 使用content-box，精确计算 */
  z-index: 1; /* 确保弹幕在正确层级 */
  max-width: 100%; /* 确保弹幕不会超出容器 */
}

@keyframes danmakuMove {
  0% { 
    transform: translateX(0); 
    opacity: 1; 
  }
  100% { 
    transform: translateX(-100vw); 
    opacity: 0; 
  }
}

.digital-human-section {
  position: absolute;
  bottom: -150px;
  left: -20px;
  width: 400px;
  height: 500px;
  z-index: 20;
  pointer-events: none;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 24px;
  background: linear-gradient(45deg, #1a1f3a, #2a2f4a, #1a1f3a);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}


/* 右上角提示 */
.top-right-prompt {
  position: absolute;
  top: 120px;
  right: 40px;
  z-index: 20;
}

.speech-bubble {
  background: var(--bubble-bg); /* 使用CSS变量，支持主题切换 */
  color: var(--bubble-color); /* 使用CSS变量，支持主题切换 */
  padding: 12px 20px;
  border-radius: 20px;
  box-shadow: var(--bubble-shadow); /* 使用CSS变量，支持主题切换 */
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  position: relative;
  animation: float 3s ease-in-out infinite;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--bubble-bg); /* 使用CSS变量，支持主题切换 */
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.bell-icon {
  font-size: 16px;
  animation: ring 2s ease-in-out infinite;
}

@keyframes ring {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* 底部装饰球 */
.bottom-orb {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none; /* 装饰元素不拦截点击 */
}

.orb-glow {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--orb-gradient); /* 使用CSS变量，支持主题切换 */
  background-size: 300% 300%;
  animation: orbRotate 4s ease infinite;
  box-shadow: var(--orb-shadow); /* 使用CSS变量，支持主题切换 */
}

@keyframes orbRotate {
  0% { 
    background-position: 0% 50%;
    transform: rotate(0deg) scale(1);
  }
  50% { 
    background-position: 100% 50%;
    transform: rotate(180deg) scale(1.1);
  }
  100% { 
    background-position: 0% 50%;
    transform: rotate(360deg) scale(1);
  }
}

/* 底部装饰区域 */
.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 5;
}

.footer-curve {
  width: 100%;
  height: 100%;
  background-color: transparent;
  background-image: url('../assets/image/db.png');
  background-repeat: no-repeat;
  background-size: cover; /* 占满底部 */
  background-position: center top; /* 向下露出顶部线条 */
  border-radius: 0;
  box-shadow: var(--footer-shadow); /* 使用CSS变量，支持主题切换 */
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header-content {
    padding: 0 20px;
  }
  
  .logo h1 {
    font-size: 18px;
  }
  
  .logo p {
    font-size: 12px;
  }
  
  .nav-menu {
    gap: 10px;
  }
  
  .nav-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .content-frame {
    width: 90%;
    height: 60%;
    margin: 0 auto; /* 移动端仍居中 */
  }
  
  
  .top-right-prompt {
    right: 20px;
  }
}

